import React from 'react'
import { observable, action, toJS, computed } from 'mobx';
import { Tools, Popover, Toast } from 'weaver-mobile'
import { SearchAdvanced, ListAdvanced, RouteLayout, Browser, BrowserHrm, Upload } from 'weaver-mobile-page';

const getLabel = Tools.getLabel;

export default class GoalRelateInfoStore {

    @observable
    goalId = ""

    @action
    changeGoalId = (goalId) => {
        this.goalId = goalId
    }

    @computed
    get goalDetailRelateTaskBrowserStore() {
        return new Browser.Store({ route: '/goalHome/goalDetail/' + this.goalId })
    }

    @computed
    get goalDetailRelateGoalBrowserStore() {
        return new Browser.Store({ route: '/goalHome/goalDetail/' + this.goalId })
    }

    @computed
    get goalDetailRelateDocBrowserStore() {
        return new Browser.Store({ route: '/goalHome/goalDetail/' + this.goalId })
    }

    @computed
    get goalDetailRelateProcessBrowserStore() {
        return new Browser.Store({ route: '/goalHome/goalDetail/' + this.goalId })
    }

    @computed
    get goalDetailRelateCustomerBrowserStore() {
        return new Browser.Store({ route: '/goalHome/goalDetail/' + this.goalId })
    }

    @computed
    get goalDetailRelateProjectBrowserStore() {
        return new Browser.Store({ route: '/goalHome/goalDetail/' + this.goalId })
    }

    @computed
    get goalDetailConnectGoalsBrowserStore() {
        return new Browser.Store({ route: '/goalHome/goalDetail/' + this.goalId })
    }

    @computed
    get goalDetailConnectTasksBrowserStore() {
        return new Browser.Store({ route: '/goalHome/goalDetail/' + this.goalId })
    }

    @observable
    category = ""

    @action
    changeCategory= (category) => {
        this.category = category
    }

    @observable
    maxUploadSize = ""

    @action
    changeMaxUploadSize = (maxUploadSize) => {
        this.maxUploadSize = maxUploadSize
    }

    @observable
    goalDatas = []

    @action
    changeGoalDatas = (goalDatas) => {
        this.goalDatas = goalDatas
    }

    @computed
    get goalFoldlistDatas() {
        return this.goalDatas.map((d, i) => {
            return {
                id: d.id,
                title: d.name,
                // user: d.principalname,
                date: "",
                commentCount: 0,
                hasChildren: false,
                comsbtn: d.comsbtn
            }
        })
    }

    @observable
    taskDatas = []

    @action
    changeTaskDatas = (taskDatas) => {
        this.taskDatas = taskDatas
    }

    @computed
    get taskFoldlistDatas() {
        return this.taskDatas.map((d, i) => {
            return {
                id: d.id,
                title: d.name,
                // user: d.principalname,
                date: "",
                commentCount: 0,
                hasChildren: false,
                comsbtn: d.comsbtn
            }
        })
    }

    @observable
    docDatas = []

    @action
    changeDocDatas = (docDatas) => {
        this.docDatas = docDatas
    }

    @computed
    get docFoldlistDatas() {
        return this.docDatas.map((d, i) => {
            return {
                id: d.id,
                title: d.name,
                // user: d.principalname,
                date: "",
                commentCount: 0,
                hasChildren: false,
                comsbtn: d.comsbtn
            }
        })
    }

    @observable
    processDatas = []

    @action
    changeProcessDatas = (processDatas) => {
        this.processDatas = processDatas
    }

    @computed
    get processFoldlistDatas() {
        return this.processDatas.map((d, i) => {
            return {
                id: d.id,
                title: d.name,
                // user: d.principalname,
                date: "",
                commentCount: 0,
                hasChildren: false,
                comsbtn: d.comsbtn
            }
        })
    }

    @observable
    customerDatas = []

    @action
    changeCustomerDatas = (customerDatas) => {
        this.customerDatas = customerDatas
    }

    @computed
    get customerFoldlistDatas() {
        return this.customerDatas.map((d, i) => {
            return {
                id: d.id,
                title: d.name,
                // user: d.principalname,
                date: "",
                commentCount: 0,
                hasChildren: false,
                comsbtn: d.comsbtn
            }
        })
    }

    @observable
    projectDatas = []

    @action
    changeProjectDatas = (projectDatas) => {
        this.projectDatas = projectDatas
    }

    @computed
    get projectFoldlistDatas() {
        return this.projectDatas.map((d, i) => {
            return {
                id: d.id,
                title: d.name,
                // user: d.principalname,
                date: "",
                commentCount: 0,
                hasChildren: false,
                comsbtn: d.comsbtn
            }
        })
    }

    @observable
    fileDatas = []

    @action
    changeFileDatas = (fileDatas) => {
        this.fileDatas = fileDatas
    }

    @computed
    get fileFoldlistDatas() {
        return this.fileDatas.map((d, i) => {
            return {
                id: d.id,
                title: d.name,
                // user: d.principalname,
                date: "",
                commentCount: 0,
                hasChildren: false,
                comsbtn: d.comsbtn
            }
        })
    }

    @observable
    connectGoals = []

    @action
    changeConnectGoals = (connectGoals) => {
        this.connectGoals = connectGoals
    }

    @computed
    get connectGoalsFoldListDatas() {
        return this.connectGoals.map((d, i) => {
            return {
                id: d.id,
                title: d.name,
                // user: d.principalname,
                date: "",
                commentCount: 0,
                hasChildren: false,
            }
        })
    }

    @observable
    connectTasks = []

    @action
    changeConnectTasks = (connectTasks) => {
        this.connectTasks = connectTasks
    }

    @computed
    get connectTasksFoldListDatas() {
        return this.connectTasks.map((d, i) => {
            return {
                id: d.id,
                title: d.name,
                // user: d.principalname,
                date: "",
                commentCount: 0,
                hasChildren: false,
            }
        })
    }



}